<template>
  <div class="bigBoxs p-15 otherStyle">
    <el-row class="searchTitle">
      <el-col>
        <!-- <el-carousel height="48px" :autoplay="false" arrow="always">
          <el-carousel-item v-for="item in 4" :key="item">
            <div class="carouselTitle">{{ item }}</div>
          </el-carousel-item>
        </el-carousel>-->
        <el-form :inline="true" :model="searchForm">
          <el-form-item label="机房名称:">
            <el-select v-model="searchForm.namer" filterable placeholder="请选择" @change="selectChange">
              <el-option v-for="item in computerRoomData" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" size="small" class="btnSizeStyle" @click="searchBtn()">查询</el-button>
          </el-form-item>
        </el-form>
      </el-col>
    </el-row>
    <el-row :gutter="18" class="pt-15">
      <el-col :span="6" v-loading="loading2">
        <div>
          <div class="col_t p_r">
            <svg class="iconfont svgSmall" aria-hidden="true">
              <use xlink:href="#el-icon-mywater_immersion" />
            </svg>
            <span class="c_1989FA f_16">水浸</span>
            <span class="upDateStyle" v-if="upData2.timeDate">
              <svg class="iconfont icon_style" aria-hidden="true"><use xlink:href="#el-icon-myupdateTime" /></svg>{{ upData2.timeTamp | dateFormat }}
            </span>
            <el-dropdown v-if="list2.length > 0" @command="handleCommand2">
              <span class="el-dropdown-link">
                <!-- {{ list2Select.zcmc }} -->
                <svg class="iconfont icon_select" aria-hidden="true"><use xlink:href="#el-icon-myselectDevice" /></svg>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item v-for="(item, index) in list2" :key="index" :command="item">{{ item.zcmc }}</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
          <div class="col_b">
            <span class="c_333333">水浸传感器</span>
            <div style="margin-left: 10px" class="upDateStyle" v-if="waterSensorList.status === 'warn' ? true : false">告警时间：{{ waterSensorList.warnDate.time | dateFormat }}</div>
            <el-row class="waterSensor">
              <el-col :span="12">
                <svg class="iconfont" aria-hidden="true">
                  <use :xlink:href="`#el-icon-mywater_${waterSensorList.status === 'warn' ? 'abnormal' : 'normal'}`" />
                </svg>
              </el-col>
              <el-col :span="12" class="ws_r">
                <div>
                  <span :class="[waterSensorList.status === 'warn' ? 'c_F94D4A' : '']">{{ statusList[waterSensorList.status] }}</span>
                </div>
              </el-col>
            </el-row>
          </div>
        </div>
      </el-col>
      <el-col :span="18" v-loading="loading0">
        <div>
          <div class="col_t p_r">
            <svg class="iconfont svgSmall" aria-hidden="true">
              <use xlink:href="#el-icon-mytemperature_humidity" />
            </svg>
            <span class="c_FF6A00 f_16">温湿度</span>
            <!-- <span class="upDateStyle" v-if="upData0.timeDate">更新时间：{{ upData0.timeDate }}</span> -->
            <span class="upDateStyle" v-if="upData0.timeDate">
              <svg class="iconfont icon_style" aria-hidden="true"><use xlink:href="#el-icon-myupdateTime" /></svg>{{ upData0.timeTamp | dateFormat }}
            </span>
            <el-dropdown v-if="list0.length > 0" @command="handleCommand0" class="dropdown_warp">
              <span class="el-dropdown-link">
                <!-- {{ list0Select.zcmc }} -->
                <svg class="iconfont icon_select" aria-hidden="true"><use xlink:href="#el-icon-myselectDevice" /></svg>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item v-for="(item, index) in list0" :key="index" :command="item">{{ item.zcmc }}</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
          <div class="col_b">
            <div class="humiditySensor">
              <div class="b_l">
                <span class="c_333333">实时温湿度</span>
                <el-row class="waterSensor">
                  <el-col :span="12">
                    <svg class="iconfont" aria-hidden="true">
                      <use xlink:href="#el-icon-mytemperature" />
                    </svg>
                  </el-col>
                  <el-col :span="12" class="ws_r">
                    <div>
                      <span style="color: #ff9900">{{ temperatureSensorList.temperature }}℃</span>
                      <span>机房温度</span>
                    </div>
                  </el-col>
                </el-row>
                <el-row class="waterSensor">
                  <el-col :span="12">
                    <svg class="iconfont" aria-hidden="true">
                      <use xlink:href="#el-icon-myhumidity" />
                    </svg>
                  </el-col>
                  <el-col :span="12" class="ws_r">
                    <div>
                      <span>{{ temperatureSensorList.humidity }}%</span>
                      <span>机房湿度</span>
                    </div>
                  </el-col>
                </el-row>
              </div>
              <div class="b_r">
                <span class="c_333333">最近一小时温湿度</span>
                <echarts-load v-if="DlFlag || reload_Dl" :chartFlag="DlFlag" :reload="reload_Dl" @refreshF="refreshDl" />
                <dlhj-line v-else :chartsData="echartData" />
              </div>
            </div>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row class="not_mb">
      <el-col :span="6">
        <div class="col_t">
          <svg class="iconfont svgSmall" aria-hidden="true">
            <use xlink:href="#el-icon-mythree_phase_electricity" />
          </svg>
          <span class="c_1989FA f_16">三相电</span>
          <!-- <span class="upDateStyle" v-if="upData1.timeDate">更新时间：{{ upData1.timeDate }}</span> -->
          <span class="upDateStyle" v-if="upData1.timeDate"
            ><svg class="iconfont icon_style" aria-hidden="true">
              <use xlink:href="#el-icon-myupdateTime" /></svg
            >{{ upData1.timeTamp | dateFormat }}</span
          >
        </div>
      </el-col>
      <el-col :span="18">
        <div class="col_t p_r">
          <el-dropdown v-if="list1.length > 0" @command="handleCommand1">
            <span class="el-dropdown-link">
              <!-- {{ list1Select.zcmc }} -->
              <svg class="iconfont icon_select" aria-hidden="true"><use xlink:href="#el-icon-myselectDevice" /></svg>
              <!-- <i class="el-icon-arrow-down el-icon--right"></i> -->
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item v-for="(item, index) in list1" :key="index" :command="item">{{ item.zcmc }}</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </el-col>
    </el-row>
    <el-row class="bd_l" v-loading="loading1">
      <el-col :span="6">
        <div class="col_b h_380">
          <span class="c_333333">市电电流、电压参数</span>
          <div class="currentVoltage">
            <el-row :gutter="18" class="title">
              <el-col :span="6">
                <span>占位符</span>
              </el-col>
              <el-col :span="6">
                <span>A相</span>
              </el-col>
              <el-col :span="6">
                <span>B相</span>
              </el-col>
              <el-col :span="6">
                <span>C相</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>电流(A)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.AXiangDianLiu }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.BXiangDianLiu }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.CXiangDianLiu }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>相电压(V)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.AXiangXiangDianYa }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.BXiangXiangDianYa }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.CXiangXiangDianYa }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>电流频率(Hz)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.AXiangDianLiuPinLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.BXiangDianLiuPinLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.CXiangDianLiuPinLv }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>电压频率(Hz)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.AXiangDianYaPinLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.BXiangDianYaPinLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.CXiangDianYaPinLv }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18" class="title title2">
              <el-col :span="6">
                <span>占位符</span>
              </el-col>
              <el-col :span="6">
                <span>AB线</span>
              </el-col>
              <el-col :span="6">
                <span>BC线</span>
              </el-col>
              <el-col :span="6">
                <span>AC线</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>线电压(V)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.AXiangXianDianYa }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.BXiangXianDianYa }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ threePhaseSensorList.CXiangXianDianYa }}</span>
              </el-col>
            </el-row>
          </div>
        </div>
      </el-col>
      <el-col :span="18">
        <div class="col_b h_380">
          <span class="c_333333">市电功率参数</span>
          <div class="currentVoltage">
            <el-row :gutter="18" class="title">
              <el-col :span="4">
                <span>占位符</span>
              </el-col>
              <el-col :span="5">
                <span>A相</span>
              </el-col>
              <el-col :span="5">
                <span>B相</span>
              </el-col>
              <el-col :span="5">
                <span>C相</span>
              </el-col>
              <el-col :span="5">
                <span>合计</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="4">
                <span>视在功率(KVA)</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.AXiangShiZaiGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.BXiangShiZaiGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.CXiangShiZaiGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.SzglTotal }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="4">
                <span>有功功率(KW)</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.AXiangYouGongGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.BXiangYouGongGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.CXiangYouGongGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.YgglTotal }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="4">
                <span>无功功率(KVar)</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.AXiangWuGongGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.BXiangWuGongGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.CXiangWuGongGongLv }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.WgglTotal }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="4">
                <span>功率因数(%)</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.AXiangGongLvYinShu }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.BXiangGongLvYinShu }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.CXiangGongLvYinShu }}</span>
              </el-col>
              <el-col :span="5">
                <span>{{ threePhaseSensorList.GlysTotal }}</span>
              </el-col>
            </el-row>
          </div>
        </div>
      </el-col>
    </el-row>
    <el-row class="not_mb">
      <el-col :span="6">
        <div class="col_t">
          <svg class="iconfont svgSmall" aria-hidden="true">
            <use xlink:href="#el-icon-myups" />
          </svg>
          <span class="c_039D12 f_16">UPS电源</span>
          <!-- <span class="upDateStyle" v-if="upData3.timeDate">更新时间：{{ upData3.timeDate }}</span> -->
          <span class="upDateStyle" v-if="upData3.timeDate">
            <svg class="iconfont icon_style" aria-hidden="true"><use xlink:href="#el-icon-myupdateTime" /></svg>{{ upData3.timeTamp | dateFormat }}
          </span>
        </div>
      </el-col>
      <el-col :span="18">
        <div class="col_t p_r">
          <el-dropdown v-if="list3.length > 0" @command="handleCommand3">
            <span class="el-dropdown-link">
              <!-- {{ list3Select.zcmc }} -->
              <svg class="iconfont icon_select" aria-hidden="true"><use xlink:href="#el-icon-myselectDevice" /></svg>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item v-for="(item, index) in list3" :key="index" :command="item">{{ item.zcmc }}</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </div>
      </el-col>
    </el-row>
    <el-row class="bd_l" v-loading="loading3">
      <el-col :span="8">
        <div class="col_b h_420">
          <div>
            <span class="c_333333">UPS输入参数</span>
            <div class="currentVoltage upbVoltage">
              <el-row :gutter="18" class="title">
                <el-col :span="6">
                  <span>占位符</span>
                </el-col>
                <el-col :span="6">
                  <span>A相</span>
                </el-col>
                <el-col :span="6">
                  <span>B相</span>
                </el-col>
                <el-col :span="6">
                  <span>C相</span>
                </el-col>
              </el-row>
              <el-row :gutter="18">
                <el-col :span="6">
                  <span>电压(V)</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.RXiangShuRuDianYa }}</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.SXiangShuRuDianYa }}</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.TXiangShuRuDianYa }}</span>
                </el-col>
              </el-row>
              <el-row :gutter="18">
                <el-col :span="6">
                  <span>频率(HZ)</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.RXiangShuRuPinLv }}</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.SXiangShuRuPinLv }}</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.TXiangShuRuPinLv }}</span>
                </el-col>
              </el-row>
            </div>
          </div>
          <div class="bd_t">
            <span class="c_333333">UPS旁路输入</span>
            <div class="currentVoltage upbVoltage">
              <el-row :gutter="18" class="title">
                <el-col :span="6">
                  <span>占位符</span>
                </el-col>
                <el-col :span="6">
                  <span>A相</span>
                </el-col>
                <el-col :span="6">
                  <span>B相</span>
                </el-col>
                <el-col :span="6">
                  <span>C相</span>
                </el-col>
              </el-row>
              <el-row :gutter="18">
                <el-col :span="6">
                  <span>电压(V)</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.RXiangPangLuDianYa }}</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.SXiangPangLuDianYa }}</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.TXiangPangLuDianYa }}</span>
                </el-col>
              </el-row>
              <el-row :gutter="18">
                <el-col :span="6">
                  <span>频率(HZ)</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.RXiangPangLuPinLv }}</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.SXiangPangLuPinLv }}</span>
                </el-col>
                <el-col :span="6">
                  <span>{{ upsPowerSupply.TXiangPangLuPinLv }}</span>
                </el-col>
              </el-row>
            </div>
          </div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="col_b h_420">
          <span class="c_333333">UPS输出参数</span>
          <div class="currentVoltage upbVoltage">
            <el-row :gutter="18" class="title">
              <el-col :span="6">
                <span>占位符</span>
              </el-col>
              <el-col :span="6">
                <span>A相</span>
              </el-col>
              <el-col :span="6">
                <span>B相</span>
              </el-col>
              <el-col :span="6">
                <span>C相</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>电压(V)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.RXiangShuChuDianYa }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.SXiangShuChuDianYa }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.TXiangShuChuDianYa }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>电流(A)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.RXiangShuChuDianLiu }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.SXiangShuChuDianLiu }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.TXiangShuChuDianLiu }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>频率(HZ)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.RXiangShuChuPinLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.SXiangShuChuPinLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.TXiangShuChuPinLv }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>有功功率(KW)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.RXiangYouGongGongLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.SXiangYouGongGongLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.TXiangYouGongGongLv }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>视在功率(KVA)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.RXiangShiZaiGongLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.SXiangShiZaiGongLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.TXiangShiZaiGongLv }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>负载率(%)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.RXiangFuZaiLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.SXiangFuZaiLv }}</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.TXiangFuZaiLv }}</span>
              </el-col>
            </el-row>
          </div>
        </div>
      </el-col>
      <el-col :span="8">
        <div class="col_b h_420">
          <span class="c_333333">UPS电池状态</span>
          <div class="currentVoltage upbVoltage uspBattery">
            <el-row :gutter="18" class="title">
              <el-col :span="6">
                <span>占位符</span>
              </el-col>
              <el-col :span="6">
                <span>占位符</span>
              </el-col>
              <el-col :span="6">
                <span>占位符</span>
              </el-col>
              <el-col :span="6">
                <span>占位符</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>正充电电压(V)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.zhengChongDianDianYa }}</span>
              </el-col>
              <el-col :span="6">
                <span>负充电电压(V)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.fuChongDianDianYa }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>正充电电流(A)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.zhengChongDianDianLiu }}</span>
              </el-col>
              <el-col :span="6">
                <span>负充电电流(A)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.fuChongDianDianLiu }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>正电池电压(V)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.zhengDianChiDianYa }}</span>
              </el-col>
              <el-col :span="6">
                <span>负电池电压(V)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.fuDianChiDianYa }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>充电器温度(℃)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.chongDianQiWenDu }}</span>
              </el-col>
              <el-col :span="6">
                <span>电池容量(%)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.dianChiRongLiang }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>剩余放电时间(分)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.shengYuFangDianShiJian }}</span>
              </el-col>
              <el-col :span="6">
                <span>模块温度(℃)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.moKuaiWenDu }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>电池温度1(℃)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.dianChiWenDu1 }}</span>
              </el-col>
              <el-col :span="6">
                <span>电池温度2(℃)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.dianChiWenDu2 }}</span>
              </el-col>
            </el-row>
            <el-row :gutter="18">
              <el-col :span="6">
                <span>电池温度3(℃)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.dianChiWenDu3 }}</span>
              </el-col>
              <el-col :span="6">
                <span>电池温度4(℃)</span>
              </el-col>
              <el-col :span="6">
                <span>{{ upsPowerSupply.dianChiWenDu4 }}</span>
              </el-col>
            </el-row>
          </div>
        </div>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import { timeLoad } from '@/assets/js/setTime'
import { getUrl } from '@/utils/getUrl.js'
import echartsLoad from '@/components/Echarts/echartsLoad'
import dlhjLine from '@/components/Echarts/dlhjLine'
import { ziC, socketPath_dlhj } from '@/utils/allUrl.js'
import { accMul, accAdd, fun_date, formatDateTime3, accSub } from '@/assets/js/videoTab.js'
// import { createSocket, sendWSPush } from '@/assets/js/dlhj_socket.js'
// import networkAccessListVue from '../../networkAccess/networkAccessList.vue'
export default {
  data() {
    return {
      searchForm: {
        namer: '',
      },
      computerRoomData: [],
      DlFlag: false,
      reload_Dl: false,
      dlTimer: null,
      echartData: {},
      statusList: {
        normal: '正常',
        warn: '告警',
        resume: '恢复正常',
        noData: '暂无数据',
        k: '--',
      },
      list0: [], // 温湿度传感器设备list
      list0Select: '', // 选中项
      list1: [], // 三相电传感器设备list
      list1Select: '', // 选中项
      list2: [], // 水浸传感器设备list
      list2Select: '', // 选中项
      list3: [], // ups电源设备list
      list3Select: '', // 选中项
      waterSensorList: {
        // 水浸
        status: 'k', // normal-正常、warn-告警、resume-恢复正常
        createDate: {},
        updateDate: '',
        warnDate: {
          time: '',
        },
      },
      temperatureSensorList: {
        temperature: '--', // 温度
        humidity: '--', // 湿度
        createDate: {},
      },
      threePhaseSensorList: {
        AXiangDianLiu: 0, // A 相电流，无符号数，单位0.01A
        BXiangDianLiu: 0, // B 相电流，无符号数，单位0.01A
        CXiangDianLiu: 0, // C 相电流，无符号数，单位0.01A
        AXiangXiangDianYa: 0, // A 相相电压（Uan），无符号数，单位0.1V
        BXiangXiangDianYa: 0, // B 相相电压（Ubn），无符号数，单位0.1V
        CXiangXiangDianYa: 0, // C 相相电压（Ucn），无符号数，单位0.1V
        AXiangDianLiuPinLv: 0, // A 相电流频率，无符号数，单位0.1Hz
        BXiangDianLiuPinLv: 0, // B 相电流频率，无符号数，单位0.1Hz
        CXiangDianLiuPinLv: 0, // C 相电流频率，无符号数，单位0.1Hz
        AXiangDianYaPinLv: 0, // A 相电压频率，无符号数，单位0.1Hz
        BXiangDianYaPinLv: 0, // B 相电压频率，无符号数，单位0.1Hz
        CXiangDianYaPinLv: 0, // C 相电压频率，无符号数，单位0.1Hz
        AXiangXianDianYa: 0, // AB 相线电压（Uab），无符号数，单位0.1V
        BXiangXianDianYa: 0, // BC 相线电压（Ubc），无符号数，单位0.1V
        CXiangXianDianYa: 0, // AC 相线电压（Uca），无符号数，单位0.1V
        AXiangShiZaiGongLv: 0, // A 相视在功率，无符号数，单位0.01kVA
        BXiangShiZaiGongLv: 0, // B 相视在功率，无符号数，单位0.01kVA
        CXiangShiZaiGongLv: 0, // C 相视在功率，无符号数，单位0.01kVA
        // 视在功率合计
        SzglTotal: 0,
        AXiangYouGongGongLv: 0, // A 相有功功率，有符号数，单位0.01kW
        BXiangYouGongGongLv: 0, // B 相有功功率，有符号数，单位0.01kW
        CXiangYouGongGongLv: 0, // C 相有功功率，有符号数，单位0.01kW
        // 有功功率合计
        YgglTotal: 0,
        AXiangWuGongGongLv: 0, // A 相无功功率，有符号数，单位0.01kVar
        BXiangWuGongGongLv: 0, // B 相无功功率，有符号数，单位0.01kVar
        CXiangWuGongGongLv: 0, // C 相无功功率，有符号数，单位0.01kVar
        // 无功功率合计
        WgglTotal: 0,
        AXiangGongLvYinShu: 0, // A 相功率因数，无符号数，单位0.01%
        BXiangGongLvYinShu: 0, // B 相功率因数，无符号数，单位0.01%
        CXiangGongLvYinShu: 0, // C 相功率因数，无符号数，单位0.01%
        // 功率因数合计
        GlysTotal: 0,
        createDate: {},
      },
      upsPowerSupply: {
        createDate: {},
        RXiangFuZaiLv: 0, // R 相负载率 单位：%、系数：1
        RXiangPangLuDianYa: 0, // R 相旁路电压 单位：V、系数：1
        RXiangPangLuPinLv: 0, // R 相旁路频率 单位：Hz、系数：0.1
        RXiangShiZaiGongLv: 0, // R 相视在功率 单位：KVA、系数：1
        RXiangShuChuDianLiu: 0, // R 相输出电流 单位：A、系数：0.1
        RXiangShuChuDianYa: 0, // R 相输出电压 单位：V、系数：0.1
        RXiangShuChuPinLv: 0, // R 相输出频率 单位：Hz、系数：0.1
        RXiangShuRuDianYa: 0, // R 相输入电压 单位：V、系数：1
        RXiangShuRuPinLv: 0, // R 相输入频率 单位：Hz、系数：0.1
        RXiangYouGongGongLv: 0, // R 相有功功率 单位：KW、系数：1
        SXiangFuZaiLv: 0, // S 相负载率 单位：%、系数：1
        SXiangPangLuDianYa: 0, // S 相旁路电压 单位：V、系数：1
        SXiangPangLuPinLv: 0, // S 相旁路频率 单位：Hz、系数：0.1
        SXiangShiZaiGongLv: 0, // S 相视在功率 单位：KVA、系数：1
        SXiangShuChuDianLiu: 0, // S 相输出电流 单位：A、系数：0.1
        SXiangShuChuDianYa: 0, // S 相输出电压 单位：V、系数：0.1
        SXiangShuChuPinLv: 0, // S 相输出频率 单位：Hz、系数：0.1
        SXiangShuRuDianYa: 0, // S 相输入电压 单位：V、系数：1
        SXiangShuRuPinLv: 0, // S 相输入频率 单位：Hz、系数：0.1
        SXiangYouGongGongLv: 0, // S 相有功功率 单位：KW、系数：1
        TXiangFuZaiLv: 0, // T 相负载率 单位：%、系数：1
        TXiangPangLuDianYa: 0, // T 相旁路电压 单位：V、系数：1
        TXiangPangLuPinLv: 0, // T 相旁路频率 单位：Hz、系数：0.1
        TXiangShiZaiGongLv: 0, /// T 相视在功率 单位：KVA、系数：1
        TXiangShuChuDianLiu: 0, // T 相输出电流 单位：A、系数：0.1
        TXiangShuChuDianYa: 0, // T 相输出电压 单位：V、系数：0.1
        TXiangShuChuPinLv: 0, // T 相输出频率 单位：Hz、系数：0.1
        TXiangShuRuDianYa: 0, // T 相输入电压 单位：V、系数：1
        TXiangShuRuPinLv: 0, // T 相输入频率 单位：Hz、系数：0.1
        TXiangYouGongGongLv: 0, // T 相有功功率 单位：KW、系数：1
        chongDianQiWenDu: 0, // 充电器温度 单位：℃、系数：0.1
        dianChiRongLiang: 0, // 电池容量 单位：%、系数：1
        dianChiWenDu1: 0, // 电池温度1 单位：℃、系数：1
        dianChiWenDu2: 0, // 电池温度2 单位：℃、系数：1
        dianChiWenDu3: 0, // 电池温度3 单位：℃、系数：1
        dianChiWenDu4: 0, // 电池温度4 单位：℃、系数：1
        fuChongDianDianLiu: 0, // 负充电电流 单位：A、系数：0.1
        fuChongDianDianYa: 0, // 负充电电压 单位：V、系数：1
        fuDianChiDianYa: 0, // 负电池电压 单位：V、系数：1
        moKuaiWenDu: 0, // 模块温度 单位：℃、系数：0.1
        shengYuFangDianShiJian: 0, // 剩余放电时间 单位：min、系数：1
        zhengChongDianDianLiu: 0, // 正充电电流 单位：A、系数：0.1
        zhengChongDianDianYa: 0, // 正充电电压 单位：V、系数：1
        zhengDianChiDianYa: 0, // 正电池电压 单位：v、系数：1
      }, // ups电源
      loading0: false, // 温湿度传感器
      timer0: null,
      loading1: false, // 三相电传感器
      timer1: null,
      loading2: false, // 水浸传感器
      timer2: null,
      loading3: false, // ups电源
      timer3: null,
      upData0: {
        timeTamp: '',
        timeDate: '',
      }, // 温湿度传感器
      upData1: {
        timeTamp: '',
        timeDate: '',
      }, // 三相电传感器
      upData2: {
        timeTamp: '',
        timeDate: '',
      }, // 水浸传感器
      upData3: {
        timeTamp: '',
        timeDate: '',
      }, // ups电源
      Socket: '',
      setIntervalWesocketPush: null,
      timeout: 5000, // 60ms
      timeoutObj: null,
      zclxIds: [65625, 65624, 65626, 65629], // 0-温湿度 1-三相电 2-水浸 3-ups电源
      contentList: {},
      timer: null,
      echartsTimer: null,
    }
  },
  components: { echartsLoad, dlhjLine },
  watch: {
    DlFlag(newVal, oldVal) {
      this.dlTimer = setTimeout(() => {
        if (this.DlFlag) {
          this.DlFlag = false
          this.reload_Dl = true
        }
      }, timeLoad)
    },
    loading0(newVal, oldVal) {
      this.timer0 = setTimeout(() => {
        if (this.loading0) {
          this.loading0 = false
        }
      }, timeLoad)
    },
    loading1(newVal, oldVal) {
      this.timer1 = setTimeout(() => {
        if (this.loading1) {
          this.loading1 = false
        }
      }, timeLoad)
    },
    loading2(newVal, oldVal) {
      this.timer2 = setTimeout(() => {
        if (this.loading2) {
          this.loading2 = false
        }
      }, timeLoad)
    },
    loading3(newVal, oldVal) {
      this.timer3 = setTimeout(() => {
        if (this.loading3) {
          this.loading3 = false
        }
      }, timeLoad)
    },
  },
  computed: {
    transferHeight: function () {
      // 计算屏幕滚动高度 - nav - 导航栏
      return window.innerHeight - 70
    },
  },
  created() {
    this.getComputerRoomList()
    this.createSocket()
    this.timer = setInterval(() => {
      // 类型：0-温湿度计、1-三相电盒、2-水浸 3-ups电源
      var tem = ''
      var res = this.$http.post('milieu/date/now')
      switch (res.code) {
        case '0000':
          tem = res.data.time
          break
        default:
          tem = new Date().getTime()
          break
      }
      // 水浸传感器
      if (this.waterSensorList.updateDate) {
        this.upData2 = {
          timeTamp: this.waterSensorList.updateDate,
          timeDate: this.timeago(tem, this.waterSensorList.updateDate, '定时器-水浸传感器'),
        }
      } else {
        if (this.isObj(this.waterSensorList.createDate)) {
          this.upData2 = {
            timeTamp: this.waterSensorList.createDate.time,
            timeDate: this.timeago(tem, this.waterSensorList.createDate.time, '定时器-水浸传感器'),
          }
        }
      }
      // 温湿度传感器
      if (this.isObj(this.temperatureSensorList.createDate)) {
        this.upData0 = {
          timeTamp: this.temperatureSensorList.createDate.time,
          timeDate: this.timeago(tem, this.temperatureSensorList.createDate.time, '定时器-温湿度传感器'),
        }
      }
      // 三相电传感器
      if (this.isObj(this.threePhaseSensorList.createDate)) {
        this.upData1 = {
          timeTamp: this.threePhaseSensorList.createDate.time,
          timeDate: this.timeago(tem, this.threePhaseSensorList.createDate.time, '定时器-三相电传感器'),
        }
      }
      // ups电源
      if (this.isObj(this.upsPowerSupply.createDate)) {
        this.upData3 = {
          timeTamp: this.upsPowerSupply.createDate.time,
          timeDate: this.timeago(tem, this.upsPowerSupply.createDate.time, '定时器-ups电源'),
        }
      }

      console.log('-----', this.upData1)
    }, 1000 * 20)
    this.echartsTimer = setInterval(() => {
      if (this.list0Select !== '') {
        clearTimeout(this.dlTimer)
        this.DlFlag = true
        this.reload_Dl = false
        this.temperatureSensor(this.list0Select.serialNo1)
      }
    }, 1000 * 30)
  },
  methods: {
    // 建立websocket连接
    createSocket() {
      this.Socket && this.Socket.close()
      if (!this.Socket) {
        console.log('建立websocket连接')
        this.Socket = new WebSocket(socketPath_dlhj)
        this.Socket.onopen = this.onopenWS
        this.Socket.onmessage = this.getsocketData
        this.Socket.onerror = this.onerrorWS
        this.Socket.onclose = this.oncloseWS
      } else {
        console.log('websocket已连接')
      }
    },
    // 打开之后发送心跳
    onopenWS() {
      this.sendHeartBeat()
    },
    // 连接失败
    onerrorWS() {
      this.Socket.close()
      clearInterval(this.setIntervalWesocketPush)
      console.log('连接失败')
    },
    // 断开重连
    oncloseWS() {
      clearInterval(this.setIntervalWesocketPush)
      console.log('websocket已断开')
    },
    // 发送心跳
    sendHeartBeat(time = 5000) {
      clearInterval(this.setIntervalWesocketPush)
      var token = getUrl('X-Cmmop-User-Token')
      var list = { heartBeat: true, token: token }
      this.Socket.send(JSON.stringify(list))
      this.setIntervalWesocketPush = setInterval(() => {
        this.Socket.send(JSON.stringify(list))
      }, time)
    },
    // 发送数据
    sendWSPush(message) {
      if (this.Socket.readyState === 1) {
        this.Socket.send(JSON.stringify(message))
      }
    },
    // 数据接收统一处理
    getsocketData(e) {
      const data = e && e.data
      const res = JSON.parse(data)
      switch (res.code) {
        case '0000':
          if (res.data) {
            this.writeInfo(res)
          }
          break
        case '0013': // 无数据-不需要操作
          break
        case '0014': // 登录超时
          break
        default:
          this.$message.error(res.message)
          break
      }
    },
    async writeInfo(res) {
      // console.log(res)
      // socket 接收消息处理
      // 类型：0-温湿度计、1-三相电盒、2-水浸 3-ups电源
      var list = res.data.info
      if (res.data.info.relSerialNo === this[`list${res.data.type}Select`].serialNo1) {
        switch (res.data.type) {
          case 0: // 温度计时间
            this.temperatureSensorList.temperature = accMul(list.temperature, 0.1) // 温度
            this.temperatureSensorList.humidity = accMul(list.humidity, 0.1) // 湿度
            break
          case 1: // 三相电传感器
            this.setThreePhaseSensorList(list)
            break
          case 2: // 水浸传感器
            this.waterSensorList = {
              status: list.status, // normal-正常、warn-告警、resume-恢复正常
              updateDate: list.updateDate.time,
              createDate: list.createDate,
              warnDate: list.warnDate || { time: '' },
            }
            break
          case 3: // ups电源
            this.upsPowerSupply = {
              // updateDate: list.updateDate.time,
              createDate: list.createDate,
              RXiangFuZaiLv: list.RXiangFuZaiLv, // R 相负载率 单位：%、系数：1
              RXiangPangLuDianYa: list.RXiangPangLuDianYa, // R 相旁路电压 单位：V、系数：1
              RXiangPangLuPinLv: accMul(list.RXiangPangLuPinLv, 0.1), // R 相旁路频率 单位：Hz、系数：0.1
              RXiangShiZaiGongLv: list.RXiangShiZaiGongLv, // R 相视在功率 单位：KVA、系数：1
              RXiangShuChuDianLiu: accMul(list.RXiangShuChuDianLiu, 0.1), // R 相输出电流 单位：A、系数：0.1
              RXiangShuChuDianYa: accMul(list.RXiangShuChuDianYa, 0.1), // R 相输出电压 单位：V、系数：0.1
              RXiangShuChuPinLv: accMul(list.RXiangShuChuPinLv, 0.1), // R 相输出频率 单位：Hz、系数：0.1
              RXiangShuRuDianYa: list.RXiangShuRuDianYa, // R 相输入电压 单位：V、系数：1
              RXiangShuRuPinLv: accMul(list.RXiangShuRuPinLv, 0.1), // R 相输入频率 单位：Hz、系数：0.1
              RXiangYouGongGongLv: list.RXiangYouGongGongLv, // R 相有功功率 单位：KW、系数：1
              SXiangFuZaiLv: list.SXiangFuZaiLv, // S 相负载率 单位：%、系数：1
              SXiangPangLuDianYa: list.SXiangPangLuDianYa, // S 相旁路电压 单位：V、系数：1
              SXiangPangLuPinLv: accMul(list.SXiangPangLuPinLv, 0.1), // S 相旁路频率 单位：Hz、系数：0.1
              SXiangShiZaiGongLv: list.SXiangShiZaiGongLv, // S 相视在功率 单位：KVA、系数：1
              SXiangShuChuDianLiu: accMul(list.SXiangShuChuDianLiu, 0.1), // S 相输出电流 单位：A、系数：0.1
              SXiangShuChuDianYa: accMul(list.SXiangShuChuDianYa, 0.1), // S 相输出电压 单位：V、系数：0.1
              SXiangShuChuPinLv: accMul(list.SXiangShuChuPinLv, 0.1), // S 相输出频率 单位：Hz、系数：0.1
              SXiangShuRuDianYa: list.SXiangShuRuDianYa, // S 相输入电压 单位：V、系数：1
              SXiangShuRuPinLv: accMul(list.SXiangShuRuPinLv, 0.1), // S 相输入频率 单位：Hz、系数：0.1
              SXiangYouGongGongLv: list.SXiangYouGongGongLv, // S 相有功功率 单位：KW、系数：1
              TXiangFuZaiLv: list.TXiangFuZaiLv, // T 相负载率 单位：%、系数：1
              TXiangPangLuDianYa: list.TXiangPangLuDianYa, // T 相旁路电压 单位：V、系数：1
              TXiangPangLuPinLv: accMul(list.TXiangPangLuPinLv, 0.1), // T 相旁路频率 单位：Hz、系数：0.1
              TXiangShiZaiGongLv: list.TXiangShiZaiGongLv, /// T 相视在功率 单位：KVA、系数：1
              TXiangShuChuDianLiu: accMul(list.TXiangShuChuDianLiu, 0.1), // T 相输出电流 单位：A、系数：0.1
              TXiangShuChuDianYa: accMul(list.TXiangShuChuDianYa, 0.1), // T 相输出电压 单位：V、系数：0.1
              TXiangShuChuPinLv: accMul(list.TXiangShuChuPinLv, 0.1), // T 相输出频率 单位：Hz、系数：0.1
              TXiangShuRuDianYa: list.TXiangShuRuDianYa, // T 相输入电压 单位：V、系数：1
              TXiangShuRuPinLv: accMul(list.TXiangShuRuPinLv, 0.1), // T 相输入频率 单位：Hz、系数：0.1
              TXiangYouGongGongLv: list.TXiangYouGongGongLv, // T 相有功功率 单位：KW、系数：1
              chongDianQiWenDu: accMul(list.chongDianQiWenDu, 0.1), // 充电器温度 单位：℃、系数：0.1
              dianChiRongLiang: list.dianChiRongLiang, // 电池容量 单位：%、系数：1
              dianChiWenDu1: list.dianChiWenDu1, // 电池温度1 单位：℃、系数：1
              dianChiWenDu2: list.dianChiWenDu2, // 电池温度2 单位：℃、系数：1
              dianChiWenDu3: list.dianChiWenDu3, // 电池温度3 单位：℃、系数：1
              dianChiWenDu4: list.dianChiWenDu4, // 电池温度4 单位：℃、系数：1
              fuChongDianDianLiu: accMul(list.fuChongDianDianLiu, 0.1), // 负充电电流 单位：A、系数：0.1
              fuChongDianDianYa: list.fuChongDianDianYa, // 负充电电压 单位：V、系数：1
              fuDianChiDianYa: list.fuDianChiDianYa, // 负电池电压 单位：V、系数：1
              moKuaiWenDu: accMul(list.moKuaiWenDu, 0.1), // 模块温度 单位：℃、系数：0.1
              shengYuFangDianShiJian: list.shengYuFangDianShiJian, // 剩余放电时间 单位：min、系数：1
              zhengChongDianDianLiu: accMul(list.zhengChongDianDianLiu, 0.1), // 正充电电流 单位：A、系数：0.1
              zhengChongDianDianYa: list.zhengChongDianDianYa, // 正充电电压 单位：V、系数：1
              zhengDianChiDianYa: list.zhengDianChiDianYa, // 正电池电压 单位：v、系数：1
            }
            break
        }
      }
      this[`loading${res.data.type}`] = false
    },
    // 写入三相电传感器数据
    setThreePhaseSensorList(list) {
      var SzglTotal1 = accAdd(list.AXiangShiZaiGongLv, list.BXiangShiZaiGongLv)
      var SzglTotal2 = accAdd(SzglTotal1, list.CXiangShiZaiGongLv)
      var YgglTotal1 = accAdd(list.AXiangYouGongGongLv, list.BXiangYouGongGongLv)
      var YgglTotal2 = accAdd(YgglTotal1, list.CXiangYouGongGongLv)
      var WgglTotal1 = accAdd(list.AXiangWuGongGongLv, list.BXiangWuGongGongLv)
      var WgglTotal2 = accAdd(WgglTotal1, list.CXiangWuGongGongLv)
      var GlysTotal1 = accAdd(list.AXiangGongLvYinShu, list.BXiangGongLvYinShu)
      var GlysTotal2 = accAdd(GlysTotal1, list.CXiangGongLvYinShu)
      this.threePhaseSensorList = {
        GlysTotal: accMul(this.returnFloat(GlysTotal2, 2), 0.01), // 功率因数合计
        AXiangXiangDianYa: accMul(list.AXiangXiangDianYa, 0.1), // A 相相电压（Uan），无符号数，单位0.1V
        BXiangXiangDianYa: accMul(list.BXiangXiangDianYa, 0.1), // B 相相电压（Ubn），无符号数，单位0.1V
        CXiangXiangDianYa: accMul(list.CXiangXiangDianYa, 0.1), // C 相相电压（Ucn），无符号数，单位0.1V
        AXiangDianLiuPinLv: accMul(list.AXiangDianLiuPinLv, 0.1), // A 相电流频率，无符号数，单位0.1Hz
        BXiangDianLiuPinLv: accMul(list.BXiangDianLiuPinLv, 0.1), // B 相电流频率，无符号数，单位0.1Hz
        CXiangDianLiuPinLv: accMul(list.CXiangDianLiuPinLv, 0.1), // C 相电流频率，无符号数，单位0.1Hz
        AXiangDianYaPinLv: accMul(list.AXiangDianYaPinLv, 0.1), // A 相电压频率，无符号数，单位0.1Hz
        BXiangDianYaPinLv: accMul(list.BXiangDianYaPinLv, 0.1), // B 相电压频率，无符号数，单位0.1Hz
        CXiangDianYaPinLv: accMul(list.CXiangDianYaPinLv, 0.1), // C 相电压频率，无符号数，单位0.1Hz
        AXiangXianDianYa: accMul(list.AXiangXianDianYa, 0.1), // AB 相线电压（Uab），无符号数，单位0.1V
        BXiangXianDianYa: accMul(list.BXiangXianDianYa, 0.1), // BC 相线电压（Ubc），无符号数，单位0.1V
        CXiangXianDianYa: accMul(list.CXiangXianDianYa, 0.1), // AC 相线电压（Uca），无符号数，单位0.1V
        AXiangGongLvYinShu: accMul(list.AXiangGongLvYinShu, 0.01), // A 相功率因数，无符号数，单位0.01%
        BXiangGongLvYinShu: accMul(list.BXiangGongLvYinShu, 0.01), // B 相功率因数，无符号数，单位0.01%
        CXiangGongLvYinShu: accMul(list.CXiangGongLvYinShu, 0.01), // C 相功率因数，无符号数，单位0.01%
        createDate: list.createDate,
      }
      // console.log('----------', window.location.host, '-----判断-----', window.location.host === 'hyga.hnlot.com.cn:8000', '----hyga.hnlot.com.cn:8000----')
      if (window.location.host === 'hyga.hnlot.com.cn') {
        this.threePhaseSensorList.AXiangDianLiu = list.AXiangDianLiu // A 相电流，无符号数，单位0.01A
        this.threePhaseSensorList.BXiangDianLiu = list.BXiangDianLiu // B 相电流，无符号数，单位0.01A
        this.threePhaseSensorList.CXiangDianLiu = list.CXiangDianLiu // C 相电流，无符号数，单位0.01A
        this.threePhaseSensorList.AXiangShiZaiGongLv = list.AXiangShiZaiGongLv // A 相视在功率，无符号数，单位0.01kVA
        this.threePhaseSensorList.BXiangShiZaiGongLv = list.BXiangShiZaiGongLv // B 相视在功率，无符号数，单位0.01kVA
        this.threePhaseSensorList.CXiangShiZaiGongLv = list.CXiangShiZaiGongLv // C 相视在功率，无符号数，单位0.01kVA
        this.threePhaseSensorList.AXiangYouGongGongLv = list.AXiangYouGongGongLv // A 相有功功率，有符号数，单位0.01kW
        this.threePhaseSensorList.BXiangYouGongGongLv = list.BXiangYouGongGongLv // B 相有功功率，有符号数，单位0.01kW
        this.threePhaseSensorList.CXiangYouGongGongLv = list.CXiangYouGongGongLv // C 相有功功率，有符号数，单位0.01kW
        this.threePhaseSensorList.AXiangWuGongGongLv = list.AXiangWuGongGongLv >= 65534 ? 0 : list.AXiangWuGongGongLv // A 相无功功率，有符号数，单位0.01kVar
        this.threePhaseSensorList.BXiangWuGongGongLv = list.BXiangWuGongGongLv >= 65534 ? 0 : list.BXiangWuGongGongLv // B 相无功功率，有符号数，单位0.01kVar
        this.threePhaseSensorList.CXiangWuGongGongLv = list.CXiangWuGongGongLv >= 65534 ? 0 : list.CXiangWuGongGongLv // C 相无功功率，有符号数，单位0.01kVar
        this.threePhaseSensorList.SzglTotal = this.returnFloat(SzglTotal2, 2) // 视在功率合计
        this.threePhaseSensorList.YgglTotal = this.returnFloat(YgglTotal2, 2) // 有功功率合计
        WgglTotal1 = accAdd(this.threePhaseSensorList.AXiangWuGongGongLv, this.threePhaseSensorList.BXiangWuGongGongLv)
        WgglTotal2 = accAdd(WgglTotal1, this.threePhaseSensorList.CXiangWuGongGongLv)
        this.threePhaseSensorList.WgglTotal = this.returnFloat(WgglTotal2, 2) // 无功功率合计
      } else {
        this.threePhaseSensorList.AXiangDianLiu = accMul(list.AXiangDianLiu, 0.01) // A 相电流，无符号数，单位0.01A
        this.threePhaseSensorList.BXiangDianLiu = accMul(list.BXiangDianLiu, 0.01) // B 相电流，无符号数，单位0.01A
        this.threePhaseSensorList.CXiangDianLiu = accMul(list.CXiangDianLiu, 0.01) // C 相电流，无符号数，单位0.01A
        this.threePhaseSensorList.AXiangShiZaiGongLv = accMul(list.AXiangShiZaiGongLv, 0.01) // A 相视在功率，无符号数，单位0.01kVA
        this.threePhaseSensorList.BXiangShiZaiGongLv = accMul(list.BXiangShiZaiGongLv, 0.01) // B 相视在功率，无符号数，单位0.01kVA
        this.threePhaseSensorList.CXiangShiZaiGongLv = accMul(list.CXiangShiZaiGongLv, 0.01) // C 相视在功率，无符号数，单位0.01kVA
        this.threePhaseSensorList.AXiangYouGongGongLv = accMul(list.AXiangYouGongGongLv, 0.01) // A 相有功功率，有符号数，单位0.01kW
        this.threePhaseSensorList.BXiangYouGongGongLv = accMul(list.BXiangYouGongGongLv, 0.01) // B 相有功功率，有符号数，单位0.01kW
        this.threePhaseSensorList.CXiangYouGongGongLv = accMul(list.CXiangYouGongGongLv, 0.01) // C 相有功功率，有符号数，单位0.01kW
        this.threePhaseSensorList.AXiangWuGongGongLv = accMul(list.AXiangWuGongGongLv, 0.01) // A 相无功功率，有符号数，单位0.01kVar
        this.threePhaseSensorList.BXiangWuGongGongLv = accMul(list.BXiangWuGongGongLv, 0.01) // B 相无功功率，有符号数，单位0.01kVar
        this.threePhaseSensorList.CXiangWuGongGongLv = accMul(list.CXiangWuGongGongLv, 0.01) // C 相无功功率，有符号数，单位0.01kVar
        this.threePhaseSensorList.SzglTotal = accMul(this.returnFloat(SzglTotal2, 2), 0.01) // 视在功率合计
        this.threePhaseSensorList.YgglTotal = accMul(this.returnFloat(YgglTotal2, 2), 0.01) // 有功功率合计
        this.threePhaseSensorList.WgglTotal = accMul(this.returnFloat(WgglTotal2, 2), 0.01) // 无功功率合计
      }
    },
    // 机房名称
    async getComputerRoomList() {
      const { data: res } = await this.$http.post(`${ziC}jfgl/selectAll`)
      switch (res.code) {
        case '0000':
          var list = []
          res.data.list.forEach((item, index) => {
            if (index === 0) {
              // 设置默认值
              this.searchForm.namer = item.id
              // 获取每个数据// 类型：0-温湿度、1-三相电盒、2-水浸
              this.getComputedRoomService(this.searchForm.namer)
            }
            list.push({
              label: item.computerRoomName,
              value: item.id,
            })
          })
          this.computerRoomData = list
          break
        default:
          this.$message.error(res.message)
          break
      }
    },
    selectChange(e) {
      this.searchForm.namer = e
    },
    // 查询机房
    searchBtn() {
      this.list0 = [] // 温湿度传感器设备list
      this.list0Select = '' // 选中项
      this.list1 = [] // 三相电传感器设备list
      this.list1Select = '' // 选中项
      this.list2 = [] // 水浸传感器设备list
      this.list2Select = '' // 选中项
      this.list3 = [] // ups电源设备list
      this.list3Select = '' // 选中项
      this.getComputedRoomService(this.searchForm.namer)
    },
    // 机房设备
    async getComputedRoomService(computerRoomId) {
      this.DlFlag = true
      this.reload_Dl = false
      const params = new URLSearchParams()
      params.append('computerRoomId', computerRoomId)
      params.append('M_', 200)
      const { data: res } = await this.$http.post(`${ziC}jfsb/selectAll`, params)
      // console.log(res)

      switch (res.code) {
        case '0000':
          var newList = [
            { type: 0, serialNo: [] },
            { type: 1, serialNo: [] },
            { type: 2, serialNo: [] },
            { type: 3, serialNo: [] },
          ] // 类型：0-温湿度计、1-三相电盒、2-水浸 3-ups电池
          res.data.list.forEach((item) => {
            for (let i = 0; i < this.zclxIds.length; i++) {
              if (item.zclxid === this.zclxIds[i]) {
                // 保存所有类型的数据
                newList[i].serialNo.push(item.serialNo1)
                // 每个传感器下设备数值
                this[`list${i}`].push(item)
                if (this[`list${i}`].length > 0) {
                  this[`list${i}Select`] = this[`list${i}`][0]
                }
                // 设置loading
                clearTimeout(this[`timer${i}`])
                this[`loading${i}`] = true
                if (i === 0) {
                  clearTimeout(this.dlTimer)
                  this.DlFlag = true
                }
              }
            }
          })
          // 第一次请求数据-接口
          if (this.list0.length > 0) {
            // 温湿度传感器
            this.temperatureSensor(this.list0[0].serialNo1)
          }
          if (this.list1.length > 0) {
            // 三相电传感器
            this.threePhaseSensor(this.list1[0].serialNo1)
          }
          if (this.list2.length > 0) {
            // 水浸传感器
            this.getWaterSensor(this.list2[0].serialNo1)
          }
          if (this.list3.length > 0) {
            // ups电源
            this.getUpsLogs(this.list3[0].serialNo1)
          }
          // websocket-所有数据
          // 发送消息 sendWSPush
          this.sendWSPush({
            heartBeat: false,
            token: getUrl('X-Cmmop-User-Token'),
            data: newList,
          })
          break
        default:
          this.DlFlag = false
          this.reload_Dl = false
          // 水浸传感器
          this.waterSensorList = {
            status: 'noData', // noData-暂无数据
            updateDate: '',
            createdDate: {},
          }
          // 温湿度传感器
          this.temperatureSensorList = {
            temperature: 0, // 温度
            humidity: 0, // 湿度
            createdDate: {},
          }
          this.echartData = {
            times: [],
            temperature: [], // 温度
            humidity: [], // 湿度
          }
          // 三相电传感器
          for (var k in this.threePhaseSensorList) {
            if (k === 'createdDate') {
              this.threePhaseSensorList[k] = {}
            } else {
              this.threePhaseSensorList[k] = 0
            }
          }
          for (let i = 0; i < 3; i++) {
            this[`list${i}`] = []
            this[`list${i}Select`] = []
            this[`upData${i}`] = ''
            this[`loading${i}`] = false
          }
          this.upData0 = {
            timeTamp: '',
            timeDate: '',
          }
          this.upData1 = {
            timeTamp: '',
            timeDate: '',
          }
          this.upData2 = {
            timeTamp: '',
            timeDate: '',
          }
          this.upData3 = {
            timeTamp: '',
            timeDate: '',
          } // ups电源
          if (res.code !== '0013') {
            this.$message.error(res.message)
          }
          break
      }
    },
    // 2-水浸传感器
    async getWaterSensor(relSerialNo) {
      clearTimeout(this.loading2)
      this.loading2 = true
      var newDate = ''
      const { data: newlist } = await this.$http.post('milieu/date/now')
      switch (newlist.code) {
        case '0000':
          newDate = newlist.data.time
          break
        default:
          newDate = new Date().getTime()
          break
      }
      const params = new URLSearchParams()
      params.append('relSerialNo', relSerialNo)
      params.append('page', 1)
      params.append('size', 1)
      const { data: res } = await this.$http.post('milieu/floodLogs/find', params)
      this.loading2 = false
      switch (res.code) {
        case '0000':
          this.waterSensorList = {
            status: res.data[0].status, // normal-正常、warn-告警、resume-恢复正常
            updateDate: res.data[0].updateDate.time,
            createdDate: res.data[0].createdDate,
            warnDate: res.data[0].warnDate || { time: '' },
          }
          this.upData2 = {
            timeTamp: res.data[0].createDate.time,
            timeDate: this.timeago(newDate, res.data[0].createDate.time, '接口-水浸'),
          }
          if (res.data[0].updateDate.time) {
            this.upData2 = {
              timeTamp: res.data[0].updateDate.time,
              timeDate: this.timeago(newDate, res.data[0].updateDate.time, '接口-水浸'),
            }
          }
          break
        default:
          this.waterSensorList = {
            status: 'noData', // noData-暂无数据
            updateDate: '',
            createdDate: {},
          }
          this.upData2 = {
            timeTamp: '',
            timeDate: '',
          }

          break
      }
    },
    // 0-温湿度传感器
    async temperatureSensor(relSerialNo) {
      clearTimeout(this.loading0)
      this.loading0 = true
      var newDate = ''
      const { data: newlist } = await this.$http.post('milieu/date/now')
      switch (newlist.code) {
        case '0000':
          newDate = newlist.data.time
          break
        default:
          newDate = new Date().getTime()
          break
      }
      const params = new URLSearchParams()
      params.append('relSerialNo', relSerialNo)
      params.append('page', 1)
      params.append('size', 200)
      params.append('startDate', fun_date().frontOneHour)
      const { data: res } = await this.$http.post('milieu/temHumLogs/findHistory', params)
      this.loading0 = false
      this.DlFlag = false
      this.reload_Dl = false
      switch (res.code) {
        case '0000':
          this.upData0 = {
            timeTamp: res.data[0].createDate.time,
            timeDate: this.timeago(newDate, res.data[0].createDate.time, '接口-温湿度'),
          }
          var list = res.data.reverse()
          this.temperatureSensorList = {
            temperature: accMul(list[list.length - 1].temperature, 0.1), // 温度
            humidity: accMul(list[list.length - 1].humidity, 0.1),
            createDate: list[list.length - 1].createDate,
          }
          var times = []
          var temperature = []
          var humidity = []
          list.forEach((item) => {
            times.push(formatDateTime3(item.createDate.time, 'HH:mm:ss'))
            temperature.push(accMul(item.temperature, 0.1)) // 温度
            humidity.push(accMul(item.humidity, 0.1)) // 湿度
          })
          this.echartData = {
            times: times,
            temperature: temperature, // 温度
            humidity: humidity, // 湿度
          }
          break
        default:
          if (res.code !== '0013') {
            this.DlFlag = false
            this.reload_Dl = true
          }
          this.temperatureSensorList = {
            temperature: 0, // 温度
            humidity: 0, // 湿度
            createDate: {},
          }
          this.upData0 = {
            timeTamp: '',
            timeDate: '',
          }
          this.echartData = {
            times: [],
            temperature: [], // 温度
            humidity: [], // 湿度
          }
          break
      }
    },
    // 1-三相电传感器
    async threePhaseSensor(relSerialNo) {
      clearTimeout(this.loading1)
      this.loading1 = true
      var newDate = ''
      const { data: newlist } = await this.$http.post('milieu/date/now')
      switch (newlist.code) {
        case '0000':
          newDate = newlist.data.time
          break
        default:
          newDate = new Date().getTime()
          break
      }
      const params = new URLSearchParams()
      params.append('relSerialNo', relSerialNo)
      params.append('page', 1)
      params.append('size', 1)
      params.append('startDate', fun_date().currentTime + ' 00:00:00')
      const { data: res } = await this.$http.post('milieu/sanXiangDianLogs/findHistory', params)
      this.loading1 = false
      switch (res.code) {
        case '0000':
          var list = res.data[0]
          this.upData1 = {
            timeTamp: res.data[0].createDate.time,
            timeDate: this.timeago(newDate, list.createDate.time, '接口-三相电'),
          }
          this.setThreePhaseSensorList(list)
          break
        default:
          for (var k in this.threePhaseSensorList) {
            if (k === 'createdDate') {
              this.threePhaseSensorList[k] = {}
            } else {
              this.threePhaseSensorList[k] = 0
            }
          }
          this.upData1 = {
            timeTamp: '',
            timeDate: '',
          }
          break
      }
    },
    // 3-ups电源
    async getUpsLogs(relSerialNo) {
      clearTimeout(this.timer3)
      this.loading3 = true
      var newDate = ''
      const { data: newlist } = await this.$http.post('milieu/date/now')
      switch (newlist.code) {
        case '0000':
          newDate = newlist.data.time
          break
        default:
          newDate = new Date().getTime()
          break
      }
      const params = new URLSearchParams()
      params.append('relSerialNo', relSerialNo)
      params.append('page', 1)
      params.append('size', 1)
      params.append('startDate', fun_date().currentTime + ' 00:00:00')
      const { data: res } = await this.$http.post('milieu/upsLogs/find', params)
      this.loading3 = false
      switch (res.code) {
        case '0000':
          var list = res.data[0]
          this.upData3 = {
            timeTamp: list.createDate.time,
            timeDate: this.timeago(newDate, list.createDate.time, '接口-ups电源'),
          }
          console.log(list)
          this.upsPowerSupply = {
            // updateDate: list.updateDate.time,
            createDate: list.createDate,
            RXiangFuZaiLv: list.RXiangFuZaiLv, // R 相负载率 单位：%、系数：1
            RXiangPangLuDianYa: list.RXiangPangLuDianYa, // R 相旁路电压 单位：V、系数：1
            RXiangPangLuPinLv: accMul(list.RXiangPangLuPinLv, 0.1), // R 相旁路频率 单位：Hz、系数：0.1
            RXiangShiZaiGongLv: list.RXiangShiZaiGongLv, // R 相视在功率 单位：KVA、系数：1
            RXiangShuChuDianLiu: accMul(list.RXiangShuChuDianLiu, 0.1), // R 相输出电流 单位：A、系数：0.1
            RXiangShuChuDianYa: accMul(list.RXiangShuChuDianYa, 0.1), // R 相输出电压 单位：V、系数：0.1
            RXiangShuChuPinLv: accMul(list.RXiangShuChuPinLv, 0.1), // R 相输出频率 单位：Hz、系数：0.1
            RXiangShuRuDianYa: list.RXiangShuRuDianYa, // R 相输入电压 单位：V、系数：1
            RXiangShuRuPinLv: accMul(list.RXiangShuRuPinLv, 0.1), // R 相输入频率 单位：Hz、系数：0.1
            RXiangYouGongGongLv: list.RXiangYouGongGongLv, // R 相有功功率 单位：KW、系数：1
            SXiangFuZaiLv: list.SXiangFuZaiLv, // S 相负载率 单位：%、系数：1
            SXiangPangLuDianYa: list.SXiangPangLuDianYa, // S 相旁路电压 单位：V、系数：1
            SXiangPangLuPinLv: accMul(list.SXiangPangLuPinLv, 0.1), // S 相旁路频率 单位：Hz、系数：0.1
            SXiangShiZaiGongLv: list.SXiangShiZaiGongLv, // S 相视在功率 单位：KVA、系数：1
            SXiangShuChuDianLiu: accMul(list.SXiangShuChuDianLiu, 0.1), // S 相输出电流 单位：A、系数：0.1
            SXiangShuChuDianYa: accMul(list.SXiangShuChuDianYa, 0.1), // S 相输出电压 单位：V、系数：0.1
            SXiangShuChuPinLv: accMul(list.SXiangShuChuPinLv, 0.1), // S 相输出频率 单位：Hz、系数：0.1
            SXiangShuRuDianYa: list.SXiangShuRuDianYa, // S 相输入电压 单位：V、系数：1
            SXiangShuRuPinLv: accMul(list.SXiangShuRuPinLv, 0.1), // S 相输入频率 单位：Hz、系数：0.1
            SXiangYouGongGongLv: list.SXiangYouGongGongLv, // S 相有功功率 单位：KW、系数：1
            TXiangFuZaiLv: list.TXiangFuZaiLv, // T 相负载率 单位：%、系数：1
            TXiangPangLuDianYa: list.TXiangPangLuDianYa, // T 相旁路电压 单位：V、系数：1
            TXiangPangLuPinLv: accMul(list.TXiangPangLuPinLv, 0.1), // T 相旁路频率 单位：Hz、系数：0.1
            TXiangShiZaiGongLv: list.TXiangShiZaiGongLv, /// T 相视在功率 单位：KVA、系数：1
            TXiangShuChuDianLiu: accMul(list.TXiangShuChuDianLiu, 0.1), // T 相输出电流 单位：A、系数：0.1
            TXiangShuChuDianYa: accMul(list.TXiangShuChuDianYa, 0.1), // T 相输出电压 单位：V、系数：0.1
            TXiangShuChuPinLv: accMul(list.TXiangShuChuPinLv, 0.1), // T 相输出频率 单位：Hz、系数：0.1
            TXiangShuRuDianYa: list.TXiangShuRuDianYa, // T 相输入电压 单位：V、系数：1
            TXiangShuRuPinLv: accMul(list.TXiangShuRuPinLv, 0.1), // T 相输入频率 单位：Hz、系数：0.1
            TXiangYouGongGongLv: list.TXiangYouGongGongLv, // T 相有功功率 单位：KW、系数：1
            chongDianQiWenDu: accMul(list.chongDianQiWenDu, 0.1), // 充电器温度 单位：℃、系数：0.1
            dianChiRongLiang: list.dianChiRongLiang, // 电池容量 单位：%、系数：1
            dianChiWenDu1: list.dianChiWenDu1, // 电池温度1 单位：℃、系数：1
            dianChiWenDu2: list.dianChiWenDu2, // 电池温度2 单位：℃、系数：1
            dianChiWenDu3: list.dianChiWenDu3, // 电池温度3 单位：℃、系数：1
            dianChiWenDu4: list.dianChiWenDu4, // 电池温度4 单位：℃、系数：1
            fuChongDianDianLiu: accMul(list.fuChongDianDianLiu, 0.1), // 负充电电流 单位：A、系数：0.1
            fuChongDianDianYa: list.fuChongDianDianYa, // 负充电电压 单位：V、系数：1
            fuDianChiDianYa: list.fuDianChiDianYa, // 负电池电压 单位：V、系数：1
            moKuaiWenDu: accMul(list.moKuaiWenDu, 0.1), // 模块温度 单位：℃、系数：0.1
            shengYuFangDianShiJian: list.shengYuFangDianShiJian, // 剩余放电时间 单位：min、系数：1
            zhengChongDianDianLiu: accMul(list.zhengChongDianDianLiu, 0.1), // 正充电电流 单位：A、系数：0.1
            zhengChongDianDianYa: list.zhengChongDianDianYa, // 正充电电压 单位：V、系数：1
            zhengDianChiDianYa: list.zhengDianChiDianYa, // 正电池电压 单位：v、系数：1
          }
          break
        default:
          for (var k in this.upsPowerSupply) {
            if (k === 'createdDate') {
              this.upsPowerSupply[k] = {}
            } else {
              this.upsPowerSupply[k] = 0
            }
          }
          this.upData3 = {
            timeTamp: '',
            timeDate: '',
          }
          break
      }
    },
    refreshDl() {
      this.reload_Dl = false
      this.temperatureSensor(this.list0Select.serialNo1)
    },
    // 强制保留小数 不四舍五入
    returnFloat(value, len) {
      var val = Math.round(parseFloat(value) * 100) / 100
      var xsd = val.toString().split('.')
      if (xsd.length < 2) {
        var text1 = ''
        for (var i = 0; i < len; i++) {
          text1 += '0'
        }
        val = val + '.' + text1
        return val
      }
      if (xsd.length > 1) {
        // 保留小数长度 len
        var text2 = xsd[1].toString().substring(0, len)
        val = xsd[0] + '.' + text2
        return val
      }
    },
    handleCommand0(command) {
      this.DlFlag = true
      this.reload_Dl = false
      this.list0Select = command
      this.temperatureSensor(command.serialNo1)
    },
    handleCommand1(command) {
      this.list1Select = command
      this.threePhaseSensor(command.serialNo1)
    },
    handleCommand2(command) {
      this.list2Select = command
      this.getWaterSensor(command.serialNo1)
    },
    handleCommand3(command) {
      this.list3Select = command
      this.getUpsLogs(command.serialNo1)
    },
    timeago(now, dateTimeStamp, tx) {
      // if (tx === 1) {
      // console.log('now--', this.getimestamp(now), '----dateTimeStamp-----', this.getimestamp(dateTimeStamp))
      // console.log('now--', now, '----dateTimeStamp-----', dateTimeStamp)
      // }
      var minute = 1000 * 60 // 把分，时，天，周，半个月，一个月用毫秒表示
      var hour = minute * 60
      var day = hour * 24
      var week = day * 7
      var result = ''
      // var halfamonth = day * 15
      var month = day * 30
      // var now = new Date().getTime() // 获取当前时间毫秒
      // if (tx === 1) {
      // console.log('month--', month)
      // console.log('now--', now, '----dateTimeStamp-----', dateTimeStamp)
      // console.log(tx, 'now--', this.getimestamp(now), '----dateTimeStamp-----', this.getimestamp(dateTimeStamp))
      // }
      var diffValue = accSub(now, dateTimeStamp) // 时间差
      console.log('diffValue:', diffValue)
      if (Number(diffValue) < 0) {
        return
      }
      var minC = diffValue / minute // 计算时间差的分，时，天，周，月
      var hourC = diffValue / hour
      var dayC = diffValue / day
      var weekC = diffValue / week
      var monthC = diffValue / month
      if (monthC >= 1 && monthC <= 3) {
        result = ' ' + parseInt(monthC) + '月前'
      } else if (weekC >= 1 && weekC <= 3) {
        result = ' ' + parseInt(weekC) + '周前'
      } else if (dayC >= 1 && dayC <= 6) {
        result = ' ' + parseInt(dayC) + '天前'
      } else if (hourC >= 1 && hourC <= 23) {
        result = ' ' + parseInt(hourC) + '小时前'
      } else if (minC >= 1 && minC <= 59) {
        result = ' ' + parseInt(minC) + '分钟前'
      } else if (diffValue >= 0 && diffValue <= minute) {
        result = '刚刚'
      } else {
        var datetime = new Date()
        datetime.setTime(dateTimeStamp)
        var Nyear = datetime.getFullYear()
        var Nmonth = datetime.getMonth() + 1 < 10 ? '0' + (datetime.getMonth() + 1) : datetime.getMonth() + 1
        var Ndate = datetime.getDate() < 10 ? '0' + datetime.getDate() : datetime.getDate()
        // var Nhour = datetime.getHours() < 10 ? '0' + datetime.getHours() : datetime.getHours()
        // var Nminute = datetime.getMinutes() < 10 ? '0' + datetime.getMinutes() : datetime.getMinutes()
        // var Nsecond = datetime.getSeconds() < 10 ? '0' + datetime.getSeconds() : datetime.getSeconds()
        result = Nyear + '-' + Nmonth + '-' + Ndate
      }
      return result
    },
    getimestamp(timestamp) {
      const date = new Date(timestamp) // 时间戳为10位需*1000，时间戳为13位的话不需乘1000
      const Y = date.getFullYear() + '-'
      const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'
      const D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
      var h = date.getHours() + ':'
      var m = date.getMinutes() + ':'
      var s = date.getSeconds()
      return Y + M + D + ' ' + h + m + s
    },
    // 判断对象是否为空
    isObj(obj) {
      var b = function () {
        for (var key in obj) {
          return true // 有的
        }
        return false // 空的
      }
      return b()
    },
  },
  destroyed() {
    // 在需要的时候卸载监听事件，比如离开页面
    // window.removeEventListener('onmessageWS', this.getsocketData)
    // console.log(Socket)
    clearInterval(this.setIntervalWesocketPush)
    this.Socket.onclose = this.Socket.close()
    clearInterval(this.timer)
    clearInterval(this.echartsTimer)
  },
}
</script>

<style lang="scss" scoped>
::v-deep .el-carousel {
  background-color: #fff;
  .el-carousel__arrow {
    background-color: transparent;
    color: #c0c4cc;
  }
  .el-carousel__indicators {
    display: none;
  }
}
.el-dropdown-menu {
  overflow-y: scroll;
  max-height: 200px;
  min-width: auto;
  overflow-x: hidden;
}
::v-deep .el-tabs__content {
  background-color: #f2f2f2;
}
.bigBoxs {
  .el-row {
    &.pt-15 {
      padding-top: 15px;
    }
    &.not_mb {
      margin-bottom: 0;
      background-color: #fff;
      border-bottom: 1px solid #eeefef;
      .el-col {
        .col_t {
          border-bottom: 0;
        }
        &:last-child {
          height: 50px;
        }
      }
    }
    &.bd_l {
      & > .el-col {
        border-right: 1px solid #eeefef;
        &:last-child {
          border-right: 0;
        }
      }
    }
    .el-col {
      height: 100%;
      > div {
        background-color: #fff;
      }
      .upDateStyle {
        color: #7f7f7f;
        padding: 5px 0 0 2px;
        .icon_style {
          width: 1.2em;
          height: 1.2em;
          padding: 0 2px 0 5px;
          transform: translateY(2px);
        }
      }
      .c_1989FA {
        color: #1989fa;
      }
      .c_F94D4A {
        color: #f94d4a !important;
      }
      .c_FF6A00 {
        color: #ff6a00 !important;
      }
      .c_039D12 {
        color: #039d12;
      }
      .svgSmall {
        width: 25px;
        height: 25px;
        vertical-align: bottom;
        padding-right: 5px;
      }
      .col_t {
        padding: 15px;
        box-sizing: border-box;
        border-bottom: 1px solid #eeefef;
        &.p_r {
          height: 100%;
          box-sizing: border-box;
          position: relative;
          .el-dropdown {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            .icon_select {
              width: 1.5em;
              height: 1.5em;
            }
          }
        }
      }
      .c_333333 {
        color: #333;
        font-size: 16px;
      }
      .f_16 {
        font-size: 16px;
      }
      .col_b {
        .bd_t {
          border-top: 1px solid #eeefef;
          padding-top: 20px;
        }
        height: 300px;
        box-sizing: border-box;
        padding: 20px;
        &.h_380 {
          height: 380px;
        }
        &.h_420 {
          height: 420px;
        }
        // 水浸传感器
        .waterSensor {
          padding-top: 45px;
          padding-bottom: 50px;
          margin-bottom: 0;
          .el-col {
            &:first-child {
              text-align: right;
              .iconfont {
                width: 140px;
                height: 140px;
              }
            }
            &.ws_r {
              height: 140px;
              position: relative;
              > div {
                position: absolute;
                top: 50%;
                transform: translateY(-50%);
                padding-left: 50px;
                > span {
                  display: block;
                  color: #333333;
                  &:first-child {
                    font-size: 30px;
                    color: #1989fa;
                  }
                }
              }
            }
          }
        }
        // 温湿度传感器
        .humiditySensor {
          position: relative;
          height: 100%;
          .b_l {
            position: absolute;
            left: 0;
            top: 0;
            width: 160px;
            padding-bottom: 30px;
            .el-row {
              &.waterSensor {
                padding-top: 45px;
                padding-bottom: 0;
              }
              .iconfont {
                width: 40px;
                height: 55px;
              }
              .ws_r {
                height: 55px;
                > div {
                  padding-left: 20px;
                  > span {
                    &:first-child {
                      font-size: 26px;
                    }
                  }
                }
              }
            }
          }
          .b_r {
            height: 100%;
            padding-left: 220px;
          }
        }
        // 市电电流、电压参数
        .currentVoltage {
          padding-top: 20px;
          .el-row {
            .el-col {
              height: 30px;
              line-height: 30px;
              > span {
                display: inline-block;
                height: 100%;
                width: 100%;
                text-align: center;
                background-color: #e8f3ff;
                font-size: 14px;
              }
              color: #1989fa;
              &:first-child {
                > span {
                  background-color: #1989fa;
                  color: #fff;
                }
              }
            }
            &.title {
              margin-bottom: 10px;
              // padding-top: 10px;
              padding-top: 0;
              .el-col {
                height: auto;
                line-height: normal;
                &:first-child {
                  opacity: 0;
                }
                > span {
                  background-color: #fff;
                  color: #333333;
                }
              }
            }
            &.title2 {
              padding-top: 20px;
            }
          }
        }
        // usp电源
        .upbVoltage {
          .el-row {
            .el-col {
              > span {
                background-color: #f0f9eb;
              }
              color: #67c23a;
              &:first-child {
                > span {
                  background-color: #67c23a;
                }
              }
            }
          }
        }
        // UPS电池状态
        .uspBattery {
          .el-row {
            .el-col {
              &:nth-child(2n + 1) {
                > span {
                  background-color: #67c23a;
                  color: #fff;
                }
              }
            }
            &.title {
              .el-col {
                opacity: 0;
              }
            }
          }
        }
      }
    }
  }
  .searchTitle {
    background-color: #fff;
    padding: 15px 0;
    margin: 0;
    padding-left: 15px;
    .el-form-item {
      margin-bottom: 0;
    }
  }
  padding-top: 15px;
  .carouselTitle {
    height: 100%;
    text-align: center;
    line-height: 48px;
  }
}

.el-dropdown {
  pointer-events: painted;
}
</style>
